package journalarray;
import java.util.*;

/**
 * This is realization for interface Comparator
 * main function is sort by date
 * @author Евгений
 */
public class SortedByDate implements Comparator<Record>{
    
    @Override
    public int compare(Record obj1, Record obj2) {
        Date date1 = obj1.getTime();
        Date date2 = obj2.getTime();
        
        if (date1.after(date2)){
            return 1;
        }
        
        if (date2.after(date1)) {
            return -1;
        }
        
        return 0;
    }

}
